<template>
	<div>
		<HomeHeader></HomeHeader>
		<HomeLeft :cur="1"></HomeLeft>
		<div id="main">
			<div id="web_con">
				<div class="web_wp">
					<div class="web_location">
						<div class="here_area">
							<strong>当前位置：</strong>商户管理&nbsp;&nbsp;»&nbsp;&nbsp;商户会员
						</div>
						<div class="here_btn">
							<a href="javascript:history.back()" class="web_btn btn_add"><em
									class="iconfont icon-shdcfanhui"></em>返回</a>
						</div>
					</div>
					<div class="filter clearfix">
						<div class="aa">
							<div class="item">
								商户名称：<b style="font-size: 16px;color: #1772f6;">{{name}}</b>
							</div>
							<div class="item">
								商户号：<b style="font-size: 16px;color: #1772f6;">{{merchantno}}</b>
							</div>
							<!-- <div class="item">
								累计收益：<b style="font-size: 16px;color: #1772f6;">{{sum2}}</b>
							</div> -->							
							<!-- <div class="item">
								<span>年月：</span>
								<el-date-picker
								      v-model="yue"
								      type="month"
								      placeholder="选择月">
								    </el-date-picker>
							</div>
							<div class="item">
								<button class="but_search" @click="Seach()">搜 索</button>
							</div> -->
							
							<!-- <div class="item" v-if="yue==''">
								会员总数：<b style="font-size: 16px;color: #1772f6;">{{listinfo.length}}</b>
							</div> -->
							
							 <div class="item" v-if="yue==''">
								会员管理预计收益：<b style="font-size: 16px;color: #1772f6;">{{sum}}</b>
							</div>
							<!-- <div class="item" v-if="yue!=''">
								本月新增会员：<b style="font-size: 16px;color: #1772f6;">8</b>
							</div>
							<div class="item" v-if="yue!=''">
								本月会员存入汇总：<b style="font-size: 16px;color: #1772f6;">80000</b>
							</div>
							<div class="item" v-if="yue!=''">
								本月新增会员存入合计：<b style="font-size: 16px;color: #1772f6;">50000</b>
							</div> -->
						</div>
						<div class="bb">
							<!-- <a href="javascript:;" class="web_btn btn_refresh"><em
									class="iconfont icon-shdcexcel"></em>导出</a> -->
							<a href="javascript:;" class="web_btn btn_refresh" @click="Refresh()"><em
									class="iconfont icon-shdcshuaxin"></em>刷新</a>
						</div>
					</div>

					<div class="web_table">
						<table>
							<tr>
								<!-- <th class="tac" style="width: 60px;">选择</th> -->
								<th class="tac">会员名称</th>
								<th class="tac">手机号</th>
								<th class="tac">注册时间</th>
								<th class="tac">到期累计收益</th>
								 <th class="tac">进行中的累计金额</th>
								 <th class="tac">会员管理预计收益</th>
								<!-- <th class="tac">查看明细</th> -->
							</tr>
							<tr v-for="(item,i) in listinfo" :key="i">
								<td class="tac">{{item.nickname}}</td>
								<td class="tac">{{item.phone}}</td>
								<td class="tac">{{common.DateToString(item.created_at,1)}}</td>
								<td class="tac">{{item.expiredFee}}</td>
								<td class="tac">{{item.totalFee}}</td>
								<td class="tac">{{item.totalFee*0.06}}</td>
								<!-- <td class="tac">
									<navigator :url="'/pages/shop/expect?id=' + item.id + '&name=' + item.nickname" hover-class="none"
										class="editBtn" title="查看明细">
									</navigator>
								</td> -->
							</tr>
							
						</table>
					</div>
					<!-- <div class="web_page">
						<el-pagination background @current-change="ChengPage" :current-page="page" :page-size="10"
							layout="total,prev, pager,next" :total="listinfo.total">
						</el-pagination>
					</div> -->
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	import HomeHeader from '../components/Header.vue'
	import HomeLeft from '../components/Left.vue'
	export default {
		components: {
			HomeHeader,
			HomeLeft,

		},
		data() {
			return {
				page: 1,
				listinfo: [],
				keywords: '',
				id:0,
				merchantno:0,
				name:'',
				sum:0,
				sum2:0,
				yue:'',
			}
		},
		onLoad(e) {
			this.id = e.id;
			this.merchantno = e.merchantno;
			this.name = e.name;
			this.GetList();
		},
		methods: {
			Refresh: function() {
				this.keywords = '';
				this.Seach();
			},
			Seach: function() {
				this.page = 1;
				this.GetList();
			},
			GetList: function(id, merchantno) {
				let that = this;
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				let _data = {
					merchantno: that.merchantno,
					page: that.page,
					per_page:1000,
				};
				that.common.http('GET', 'merchant/' + that.id + '/member', _data, function(res) {
					uni.hideLoading();
					console.log(res.data)
					that.listinfo = res.data;
					that.sum = res.data.reduce((acc, obj) => acc + obj.predictFee*1, 0);
					that.sum2 = res.data.reduce((acc, obj) => acc + obj.expiredFee*1, 0);
				});
			},
			LookTest: function(id) {
				uni.navigateTo({
					url: '/pages/member/info?id=' + id
				})
			},
		}
	}
</script>

<style>


</style>